/**
 * Description: Hello World!
 * author: 何雨轩
 * Create at: 18/8/7 下午4:59
 */

// 懒汉式
public class Singleton2 {
    //私有的默认构造子
    private Singleton2() {
    }

    //注意，这里没有final
    private static Singleton2 single = null;

    //静态工厂方法
    public synchronized static Singleton2 getInstance() {
        if (single == null) {
            single = new Singleton2();
        }
        return single;
    }
}
